package com.anxin.act.task.web;

import java.util.List;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anxin.framework.aspectj.lang.annotation.Log;
import com.anxin.framework.aspectj.lang.enums.BusinessType;
import com.anxin.act.task.entity.WfUsedOpinion;
import com.anxin.act.task.service.WfUsedOpinionService;
import com.anxin.framework.web.controller.BaseController;
import com.anxin.framework.web.entity.AjaxResult;
import com.anxin.common.utils.poi.ExcelUtil;
import com.anxin.framework.web.page.TableDataInfo;

/**
 * 快捷意见Controller
 *
 * @author jbs
 * @date 2022-08-10
 */
//@Api(tags = "快捷意见" )
@RestController
@RequestMapping("/task/wfUsedOpinion")
public class WfUsedOpinionController extends BaseController{
    @Autowired
    private WfUsedOpinionService wfUsedOpinionService;

    /**
     * 查询快捷意见列表
     */
    //@ApiOperation(value="查询快捷意见列表" ,notes="作者:jbs")
    @GetMapping("/list")
    @Log(title = "查询快捷意见列表", businessType = BusinessType.LIST)
    public TableDataInfo<List<WfUsedOpinion>> list(WfUsedOpinion wfUsedOpinion){
        List<WfUsedOpinion> list = wfUsedOpinionService.findList(wfUsedOpinion);
        return getDataTable(list);
    }

    /**
     * 导出快捷意见列表
     */
    //@ApiOperation(value="导出快捷意见列表",notes="作者:jbs")
    @Log(title = "快捷意见", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WfUsedOpinion wfUsedOpinion) {
        List<WfUsedOpinion> list = wfUsedOpinionService.findList(wfUsedOpinion);
        ExcelUtil<WfUsedOpinion> util = new ExcelUtil<WfUsedOpinion>(WfUsedOpinion.class);
        return util.exportExcel(list, "task");
    }

    /**
     * 获取快捷意见详细信息
     */
    //@ApiOperation(value="获取快捷意见详细信息",notes="作者:jbs")
    @GetMapping(value = "/{id}")
    @Log(title = "获取快捷意见详细信息", businessType = BusinessType.LIST)
    public AjaxResult<WfUsedOpinion> getInfo(@PathVariable("id") String id){
        return AjaxResult.success(wfUsedOpinionService.getById(id));
    }

    /**
     * 保存快捷意见
     */
    //@ApiOperation(value="保存快捷意见",notes="作者:jbs")
    @Log(title = "快捷意见", businessType = BusinessType.INSERT)
    @PostMapping("/save")
    public AjaxResult save(@RequestBody WfUsedOpinion wfUsedOpinion){
        wfUsedOpinionService.save(wfUsedOpinion);
        return AjaxResult.success(wfUsedOpinion);
    }


    /**
     * 删除快捷意见
     */
    //@ApiOperation(value="删除快捷意见",notes="作者:jbs")
    @Log(title = "快捷意见", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable(("id")) String id){
        return toAjax(wfUsedOpinionService.deleteById(id));
    }
}
